package com.holly.unit.email.starter;

import com.holly.unit.email.api.MailSenderApi;
import com.holly.unit.email.jdk.JavaMailSender;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 邮件发送的自动配置类
 *
 * @author holly
 * @date 2020/12/1 11:25
 */
@Configuration
public class HollyEmailAutoConfiguration {

    /**
     * java mail方式发送邮件的接口
     *
     * @author holly
     * @date 2020/12/1 11:32
     */
    @Bean
    @ConditionalOnMissingBean(MailSenderApi.class)
    public MailSenderApi mailSenderApi() {
        return new JavaMailSender();
    }
}
